/*     */ package www.nomina.controller.bean.sat;
/*     */ 

/*     */ import java.util.Calendar;
/*     */ import java.util.GregorianCalendar;
/*     */ import java.util.Locale;
/*     */ import java.util.TimeZone;
/*     */ import javax.xml.bind.DatatypeConverter;
/*     */ import javax.xml.datatype.DatatypeConfigurationException;
/*     */ import javax.xml.datatype.DatatypeFactory;
/*     */ import javax.xml.datatype.XMLGregorianCalendar;
/*     */ 
/*     */ public class JaxbUtils
/*     */ {
/*     */   public static XMLGregorianCalendar nowXML()
/*     */   {
/*  23 */     XMLGregorianCalendar xmlCal = null;
/*     */ 
/*  25 */     TimeZone tz = TimeZone.getTimeZone("America/Monterrey");
/*  26 */     Locale locale = new Locale("ES", "MX");
/*  27 */     GregorianCalendar now = (GregorianCalendar)GregorianCalendar.getInstance(tz, locale);
/*  28 */     now.clear(14);
/*     */     try
/*     */     {
/*  31 */       xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(now);
/*     */     } catch (DatatypeConfigurationException e) {
/*  33 */       System.out.println("No se pudo obtener fecha actual.");
/*     */     }
/*  35 */     return xmlCal;
/*     */   }
/*     */ 
/*     */   public static Calendar getCalendar(int year, int month, int day, int hour, int min, int sec)
/*     */   {
/*  41 */     GregorianCalendar fechaAuth = null;
/*  42 */     TimeZone tz = TimeZone.getTimeZone("America/Monterrey");
/*  43 */     Locale locale = new Locale("ES", "MX");
/*  44 */     fechaAuth = (GregorianCalendar)GregorianCalendar.getInstance(tz, locale);
/*  45 */     fechaAuth.set(year, month, day, hour, min, sec);
/*  46 */     fechaAuth.clear(14);
/*  47 */     fechaAuth.clear(15);
/*     */ 
/*  49 */     return fechaAuth;
/*     */   }
/*     */ 
/*     */   public static Calendar parseDateTime(String lexicalXSDDateTime) {
/*  53 */     if (lexicalXSDDateTime == null)
/*  54 */       return null;
/*  55 */     Calendar cal = DatatypeConverter.parseDateTime(lexicalXSDDateTime);
/*  56 */     cal.clear(14);
/*  57 */     return cal;
/*     */   }
/*     */ 
/*     */   public static String printDateTime(Calendar val) {
/*  61 */     if (val == null)
/*  62 */       return null;
/*  63 */     val.clear(14);
/*  64 */     return DatatypeConverter.printDateTime(val);
/*     */   }
/*     */ 
/*     */   public static String printDateTimeNoTZ(Calendar val) {
/*  68 */     String res = null;
/*  69 */     if (val == null)
/*  70 */       return null;
/*  71 */     val.clear(14);
/*  72 */     res = DatatypeConverter.printDateTime(val);
/*  73 */     res = res.substring(0, 19);
/*  74 */     return res;
/*     */   }
/*     */ 
/*     */   public static String printDateTimeNoTZZ(Calendar val) {
/*  78 */     String res = null;
/*  79 */     if (val == null)
/*  80 */       return null;
/*  81 */     val.clear(14);
/*  82 */     res = DatatypeConverter.printDateTime(val);
/*  83 */     res = res.substring(0, 19);
/*  84 */     return res;
/*     */   }
/*     */ 
/*     */   public static String printDateNoTZ(Calendar val) {
/*  88 */     String res = null;
/*  89 */     if (val == null)
/*  90 */       return null;
/*  91 */     val.clear(14);
/*  92 */     res = DatatypeConverter.printDate(val);
/*  93 */     res = res.substring(0, 10);
/*  94 */     return res;
/*     */   }
/*     */ 
/*     */   public static String printBase64Binary(byte[] val) {
/*  98 */     if (val == null)
/*  99 */       return null;
/* 100 */     String converted = DatatypeConverter.printBase64Binary(val);
/* 101 */     String result = converted;
/*     */ 
/* 103 */     int size = converted.length();
/* 104 */     if (size > 76) {
/* 105 */       String segmented = "";
/* 106 */       int iniIndex = 0;
/* 107 */       int finIndex = 76;
/* 108 */       while (finIndex <= size) {
/* 109 */         segmented = segmented + converted.substring(iniIndex, finIndex) + "\n";
/* 110 */         iniIndex += 76;
/* 111 */         finIndex += 76;
/*     */       }
/* 113 */       segmented = segmented + converted.substring(iniIndex, size);
/* 114 */       result = segmented;
/*     */     }
/* 116 */     return result;
/*     */   }
/*     */ }

/* Location:           /home/nastick/Diverza/TimbradoWSExample/lib/TimbradoCFDiGenerated.jar
 * Qualified Name:     common.tools.JaxbUtils
 * JD-Core Version:    0.6.2
 */